package com.lanou.utils;

import com.lanou.bean.CrmRefer;
import com.lanou.bean.Staff;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import java.util.Date;

/**
 * Created by dllo on 18/4/18.
 */
public class CrmReferFactory {
    private static CrmRefer crmRefer;

    public static Object objectFactory(String referid,String name, String telephone, String qq,
                                       String intentionLevel, String courseTypeId, String classId,
                                       String source, String remark) {
        crmRefer = new CrmRefer();
        crmRefer.setReferid(referid);
        crmRefer.setName(name);
        crmRefer.setTelephone(telephone);
        crmRefer.setQq(qq);
        crmRefer.setIntentionlevel(intentionLevel);
        crmRefer.setCoursetypeid(courseTypeId);
        crmRefer.setClassid(classId);
        crmRefer.setSource(source);
        crmRefer.setRemark(remark);
        Subject subject = SecurityUtils.getSubject();
        Staff staff = (Staff) subject.getPrincipal();
        String staffid = staff.getStaffId();
        crmRefer.setStaffid(staffid);
        crmRefer.setCreatedate(DateTimeUtil.getSystemTimeUtil());
        return crmRefer;
    }
}
